Skip to content

Add basic link support to AppKit/macOS formatting bar #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

itsthisjustin
Copy link

This PR adds initial support for hyperlinking in the formatting bar on macOS (AppKit only for now).

What’s included:
• A link button was added to the existing toggle group in the formatting bar.
• CMD+K keyboard shortcut is now hooked up to trigger the link action.
• Clicking the button opens a sheet if the selected text does not already contain a link, allowing users to insert a URL.
• If the selected text already contains a link, the toggle is highlighted and clicking it will remove the link.

What’s not included:
• No support yet for internal links (could be added later).
• No ability to insert a link without selecting text first.

Open to suggestions for a better UI placement or UX improvements for the link feature.

@danielsaidi
Copy link
Owner

Hi @itsthisjustin

I'm sorry for this taking so long. I've been waiting for WWDC'25 due to some rich text rumors, and sure enough - we now get a native approach for RichText in the native TextEditor.

I will explore this a bit before making any decisions on this project. I think it may mean that this project will pivot away from the SwiftUI integrations, and instead focus on how to work with the attributed string in the best way.

I'll leave this open until I know more.

@danielsaidi danielsaidi force-pushed the main branch 5 times, most recently from 6afafbf to 3081c72 Compare June 23, 2025 22:30
@younky-yang
Copy link

The new native TextEditor doesn't support attachment, which lack of lots of feature for Rich text editing, so this project is pretty awesome for now and future in years.

@danielsaidi
Copy link
Owner

@younky-yang It doesn't? Even if you add the attachment to the attributed string, it doesn't render?

@younky-yang
Copy link

At least for my current test, it doesn't support any attachment. The most easy approach to test it is to copy an image to the editor and nothing copied. But this works pretty well with UIKit stuff.
I don't think Apple has plan to enable the support for the real rich text editor in new 1-2 years.

@danielsaidi
Copy link
Owner

danielsaidi commented Jul 14, 2025

Interesting, thank you for sharing! I think this leaves this library in a strange space, since the coordinator layer is what I would love to get rid of, and is what makes the library a bit too complicated to manage.

It would have been amazing if the native text editor would have received full attributed string rendering capabilities, after which we could have changed this library to just extend the attributed string type, but I guess we need it still then.

@danielsaidi
Copy link
Owner

@itsthisjustin I'm afraid WWDC and the summer has thrown too much on my place, but I will aim to get to this PR eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants